<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
	
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	$("#username").val("<#if partjob??>${partjob.username}</#if>");
	$("#type").val("<#if partjob??>${partjob.type}</#if>");
	
	$("#nickname").keyup(function(){
		var nickname = $("#nickname").val();
		
		$.post("${contextPath}/index/getUserByNickname.json", {
			"nickname" : nickname
		}, function(ms) {
			var username = ms.user.username;
			$("#c_username").val(username);
		});
	});
});

var addTravel = function(){
	var id = $("#id").val();
	var username = $("#username").val();
	var type = $("#type").val();
	var date = $("#date").val();
	var time = $("#time").val();
	var address = $("#address").val();
	
	var fd_count = $("#fd_count").val();
	var xx_count = $("#xx_count").val();
	var gongs = $("#gongs").val();
	var moneys = $("#moneys").val();
	
	if(username==""){
		infopad.err("请选择兼职人员!");
		return;
	}
	if(type==""){
		infopad.err("请选择兼职类型!");
		return;
	}
	
	
	$.post("${contextPath}/index/add_trajob.json", {
			"id":id,
			"username":username,
			"type":type,
			"date":date,
			"time":time,
			"address":address,
			"fd_count":fd_count,
			"xx_count":xx_count,
			"gongs":gongs,
			"moneys":moneys
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/prajobList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if partjob??>${partjob.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">添加兼职记录</div>
		<table id="infotable">
			
			<tr>
				<th>兼职老师姓名:</th>
				<td>
					<select id="username">
					<#if list??>
						<option value="">请选择兼职老师</option>
						<#list list as list>
							<option value="${list.username}">${list.nickname}(${list.departments}-${list.job})</option>
						</#list>
					</#if>
					</select>
					<input type="text" id="nickname" size="20" value="" placeholder="请输入姓名快速搜索">
				</td>
			</tr>
			
			<tr>
				<th>兼职类型:</th>
				<td>
					<select id="type">
						<option value="">请选择</option>
						<option value="1">前台兼职</option>
						<option value="2">训练老师兼职</option>
						<option value="3">市场兼职</option>
					</select>
				</td>
			</tr>
			
			<tr>
				<th>兼职日期:</th>
				<td>
					<input type="text" id="date" value="<#if partjob??>${partjob.date}</#if>" rel="DATE::Y-m-d" value="" size="14" maxlength="15" readonly="readonly" class="DatePicker_Icon">
				</td>
			</tr>
			
			<tr>
				<th>兼职时间:</th>
				<td>
					<input type="text" id="time" placeholder="例如：13:00-14:00" value="<#if partjob??>${partjob.time}</#if>" value="" size="30" maxlength="15" >
				</td>
			</tr>
			
			<tr>
				<th>地点:</th>
				<td>
					<input type="text" id="address" size="30" value="<#if partjob??>${partjob.address}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>发单量:</th>
				<td>
					<input type="text" id="fd_count" size="10" value="<#if partjob??>${partjob.fd_count}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')">
				</td>
			</tr>
			
			<tr>
				<th>信息量:</th>
				<td>
					<input type="text" id="xx_count" size="40" value="<#if partjob??>${partjob.xx_count}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')">
				</td>
			</tr>
			
			<tr>
				<th>工资公式:</th>
				<td>
					<input type="text" id="gongs" size="20" value="<#if partjob??>${partjob.gongs}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>薪资金额:</th>
				<td>
					<input type="text" id="moneys" size="10" value="<#if partjob??>${partjob.moneys}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')">元
				</td>
			</tr>
			
		</table>
		<div id="controlbar">
			<input type="button" class="submit" onclick="addTravel()" value="  保  存  " />
		</div>
	</div>
	
</body>
</html>